#define  _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
# define N 11
int main()
{
	int flag = 0;
	int count = 0;
	int n = 0;
	int arr[N][N] = { 0 };
	int i = 0;
	int j = 0;
	for (n = 1; n <= N-3; n++)
	{  
		for (j = n; j <= N - n; j++)
		{
			count++;
			arr[n][j]=count;
		}
		for (i = n + 1; i <= N - n; i++)
		{
			count++;
			arr[i][N - n]=count;
		}
		for (j = N - n-1; j >= n; j--)
		{
			count++;
			arr[N - n][j]=count;
		}
		for (i = N - n-1; i >= n + 1; i--)
		{
			count++;
			arr[i][n]=count;
		}
	 }
	for (i = 1; i <= N - 1; i++)
	{
		for (j = 1; j <= N -1;  j++)
		{
			printf("%4d", arr[i][j]);
			flag++;
		}
		if (flag % (N-1) == 0)
			printf("\n");
	}
	  

	return 0;
}